import javax.servlet.ServletRequest
import javax.servlet.ServletResponse
import javax.servlet.http.HttpServlet

class LoginServlet : HttpServlet() {

    override fun service(req: ServletRequest?, res: ServletResponse?) {
        if (req != null && res != null) {
            req.characterEncoding = "UTF-8"
            val username = req.getParameter("username")
            val password = req.getParameter("password")
            if (username.isNotEmpty() && password.isNotEmpty()) {
                res.contentType = "text;charset=UTF-8"
                val writer = res.writer
                writer.write("OK")
                writer.close()
            }
        }
    }
}